/****************************************************************************
 * stri_rt_update
 * creat : 20200830
 * modify: none
 * **************************************************************************/
#include "stri.h"
#include "stri_simulink.h"
#include "pulse.h"
#include "sys_task.h"

/*****************************************************************************
* @brief   stri_rt_update
* @param   none
* @return  none
*****************************************************************************/
void stri_rt_update(void)
{
	/*----------------------------------------------------------------------*/
	// 时基
	stri.mix.pulse_100ms = sys_st.pulse.pulse_100ms;
	stri.mix.pulse_1s = sys_st.pulse.pulse_1s;
	
	/*----------------------------------------------------------------------*/
	// 开关信号
	stri.mix.wat_low = sim_obj.water.b_wt_low;
	stri.mix.wat_high = sim_obj.water.b_wt_high;
	
	/*----------------------------------------------------------------------*/
	// 测量值
	stri.temp.air = sim_obj.temp.f_nei*10;
	stri.temp.obj = sim_obj.temp.f_obj*10;
	stri.temp.press = sim_obj.press.f_press*10;
	stri.temp.ext = sim_obj.temp.f_wai*10;
	
	stri.temp.f_air = sim_obj.temp.f_nei*10;
	stri.temp.f_obj = sim_obj.temp.f_obj*10;
	stri.temp.f_press = sim_obj.press.f_press*10;
	stri.temp.f_ext = sim_obj.temp.f_wai*10;
	
	/*
	stri.heat.main_pid.Pv = sim_obj.temp.f_nei*10;
	stri.heat.ext_pid.Pv = sim_obj.temp.f_wai*10;
	stri.heat.obj_pid.Pv = sim_obj.temp.f_obj*10;
	*/
	
	
	/*----------------------------------------------------------------------*/
	// rtc
	stri.mix.rtc.val = 0;
	
	/*----------------------------------------------------------------------*/
	// 补水
	stri.wat_add.ot = 120;
	stri.wat_add.dly = 20;
	
	/*----------------------------------------------------------------------*/
	// pid
	stri.heat.air_pid_tab[0] = 25;
	stri.heat.air_pid_tab[1] = 90;
	stri.heat.air_pid_tab[2] = 40;

	stri.heat.ext_pid_tab[0] = 120;
	stri.heat.ext_pid_tab[1] = 240;
	stri.heat.ext_pid_tab[2] = 180;

	stri.heat.obj_pid_tab[0] = 40;
	stri.heat.obj_pid_tab[1] = 180;
	stri.heat.obj_pid_tab[2] = 10;
	
	stri.heat.pid_t = 3;
	
	stri.heat.main_mode_set = STRI_MAIN_HEAT_OBJ_SURE;
}
